import numpy as np
from scipy import linalg as la

A = np.arange(1, 17).reshape(4, 4)
p, l, u = la.lu(a=A, permute_l=False, overwrite_a=False, check_finite=True)

print('原矩阵\n', A)
print('p矩阵\n', p)
print('l矩阵\n', l)
print('u矩阵\n', u)

print(la.inv(p))
print(l @ u)
print(la.inv(p) @ A)
print(p @ l @ u)
